package cn.zjutleo.village_server.mapper;

import cn.zjutleo.village_server.entity.NativeVillage;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Author: 张坤
 * @DateTime: 2021/8/30 18:41
 * @Description: 该类用于 TODO
 */
@Mapper
public interface NativeVillageMapper {

    @Select("select * from native_village where v_name like '%${searchInfo}%'")
    @Results( id="Base_NativeVillage_data",value = {
            @Result(property = "v_id",  column = "v_id",id = true),
            @Result(property = "v_name",  column = "v_name"),
            @Result(property = "v_info",  column = "v_info"),
            @Result(property = "v_address",  column = "v_address")
    })
    List<NativeVillage> getVillageInfoFuzzySearch(String searchInfo);

    @Select("select * from native_village where v_id = #{id}")
    @ResultMap("Base_NativeVillage_data")
    NativeVillage getVillageById(@Param("id") Integer id);
}
